@ECHO OFF

REG DELETE HKCU\Software\lolix\sdk /f 1>nul 2>nul
CALL :REG_DEL HKCU\Environment LolixPropertyPath
CALL :REG_DEL HKCU\Environment LolixIncludeRootPath
CALL :REG_DEL HKCU\Environment LolixLibX86Path
CALL :REG_DEL HKCU\Environment LolixLibX64Path
CALL :REG_DEL HKCU\Environment LolixBinX86Path
CALL :REG_DEL HKCU\Environment LolixBinX64Path
CALL :REG_DEL HKCU\Environment LolixSolutionPath

CALL :UREG_MSBUILD_PATH 3.5
CALL :UREG_MSBUILD_PATH 4.0
CALL :UREG_MSBUILD_PATH 12.0
EXIT /B 0

:UREG_MSBUILD_PATH
	SET HK_PATH=HKLM\SOFTWARE\Wow6432Node\Microsoft\MSBuild\ToolsVersions\%1
	REG QUERY %HK_PATH% 1>nul 2>nul
	IF ERRORLEVEL 1 (
		EXIT /B 1
	)
	CALL :REG_DEL %HK_PATH% LolixPropertyPath 
	CALL :REG_DEL %HK_PATH% LolixIncludeRootPath 
	CALL :REG_DEL %HK_PATH% LolixLibX86Path 
	CALL :REG_DEL %HK_PATH% LolixLibX64Path 
	CALL :REG_DEL %HK_PATH% LolixBinX86Path 
	CALL :REG_DEL %HK_PATH% LolixBinX64Path 
	CALL :REG_DEL %HK_PATH% LolixSolutionPath 
	EXIT /B 0

:REG_DEL
	REG QUERY %1\%2 1>nul 2>nul
	IF ERRORLEVEL 1 (
		EXIT /B 0
	)
	REG DELETE %1 /v %2 /f 1>nul
	EXIT /B
